

*************************************************************
*********** master do file for Holman and Kalmoe ************
***********      metoo and party reputations     ************
*********** 	Perspectives in Politics 		*************
*************************************************************

graph set window fontface "Times New Roman"
*** if not installed, install scheme lean2 ***
*** if not installed, install coefplot ***
*** if not installed, install estout ***

set scheme lean2

**** set working directory ****

cd "C:\Users\HolmanMirya\Dropbox (MH)\metoo_partisanship\replication"



************ Kavanaugh survey experiment *******************
************ this do file uses data from ************
************ an experiment fielded in Oct 2018 ******
************ on the LUCID Fulcrum platform   ********

clear

use kavanaugh_experiment.dta 

***** demographics **** 

sum female white hisp colgrad income
tab pid7

*Balance check - partytreat is imbalanced toward Reps
	
	eststo clear
	eststo balance_party2: mlogit condition pid7 
	eststo balance_dem: mlogit conditions pid7 female white hisp colgrad income 
	
	# delimit ;
	esttab using a2_lucid_balance_checks.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Balance checks" )
		 label
		addnote("Dependent variable: assignment to treatment")
		compress replace;
	 #delimit cr


	 
**** party evaluations by treatment ***** 

eststo clear 

mlogit dempolicy conditions  pid7 if speeder~=1 , nolog
eststo policy_rep: margins, at(conditions=(0(1)2)) atmeans predict(equation(-1)) post
mlogit dempolicy conditions  pid7 if speeder~=1 , nolog
eststo policy_dem: margins, at(conditions=(0(1)2)) atmeans predict(equation(1)) post
mlogit demlead conditions  pid7 if speeder~=1 , nolog
eststo lead_rep: margins, at(conditions=(0(1)2)) atmeans predict(equation(-1)) post
mlogit demlead conditions  pid7 if speeder~=1 , nolog
eststo lead_dem: margins, at(conditions=(0(1)2)) atmeans predict(equation(1)) post

	# delimit ;
	esttab using 2_lucid_effectoftreatment.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Survey experiment: effect of treatments" )
		 label
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr
	 
	 
	 
	 
**** party evaluations by treatment - control for previous exposure to hearings ***** 

eststo clear 

mlogit dempolicy conditions heard_hearings pid7 if speeder~=1 , nolog
eststo policy_rep: margins, at(conditions=(0(1)2)) atmeans predict(equation(-1)) post
mlogit dempolicy conditions heard_hearings pid7 if speeder~=1 , nolog
eststo policy_dem: margins, at(conditions=(0(1)2)) atmeans predict(equation(1)) post
mlogit demlead conditions heard_hearings pid7 if speeder~=1 , nolog
eststo lead_rep: margins, at(conditions=(0(1)2)) atmeans predict(equation(-1)) post
mlogit demlead conditions heard_hearings pid7 if speeder~=1 , nolog
eststo lead_dem: margins, at(conditions=(0(1)2)) atmeans predict(equation(1)) post

	# delimit ;
	esttab using 2_lucid_effectoftreatmentb.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Survey experiment: effect of treatments" )
		 label
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr

	 
**** party evaluations by treatment - control for previous exposure to hearings ***** 

eststo clear 

mlogit dempolicy conditions##i.heard_hearings pid7 if speeder~=1 , nolog
margins conditions#heard_hearings, atmeans predict(equation(-1))
margins conditions#heard_hearings, atmeans predict(equation(0))
margins conditions#heard_hearings, atmeans predict(equation(1))
mlogit demlead conditions##i.heard_hearings pid7 if speeder~=1 , nolog
margins conditions#heard_hearings, atmeans predict(equation(-1))
margins conditions#heard_hearings, atmeans predict(equation(0))
margins conditions#heard_hearings, atmeans predict(equation(1))

	# delimit ;
	esttab using a2_lucid_priorknow.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Survey experiment: effect of treatments" )
		 label
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr


eststo clear 

eststo policy: mlogit dempolicy i.conditions  pid7 if speeder~=1 , nolog
eststo leaders: mlogit demlead i.conditions  pid7 if speeder~=1 , nolog

	# delimit ;
	esttab using a2_lucid_mlogit.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Survey experiment: effect of treatments mlogit" )
		 label
		addnote("Dependent variable: views of party ownership")
		compress replace;
	 #delimit cr


	 **** with just those who had not heard ***** 
	 
eststo clear 

mlogit dempolicy conditions  pid7 if speeder~=1 & heard_hearings == 0, nolog
eststo policy_rep: margins, at(conditions=(0(1)2)) atmeans predict(equation(-1)) post
mlogit dempolicy conditions  pid7 if speeder~=1 & heard_hearings == 0, nolog
eststo policy_dem: margins, at(conditions=(0(1)2)) atmeans predict(equation(1)) post
mlogit demlead conditions pid7 if speeder~=1 & heard_hearings == 0, nolog
eststo lead_rep: margins, at(conditions=(0(1)2)) atmeans predict(equation(-1)) post
mlogit demlead conditions  pid7 if speeder~=1 & heard_hearings == 0, nolog
eststo lead_dem: margins, at(conditions=(0(1)2)) atmeans predict(equation(1)) post

	# delimit ;
	esttab using a2_lucid_prior_control.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Survey experiment: effect of treatments" )
		 label
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr
	 

	
eststo clear 

**** generating 0/1 party ownership variables ***** 

gen dem_own = 0
replace dem_own = 1 if dempolicy == 1
gen rep_own = 0
replace rep_own = 1 if dempolicy == -1


gen dem_lead = 0
replace dem_lead = 1 if demlead == 1
gen rep_lead = 0
replace rep_lead = 1 if demlead == -1

		eststo dem_lead: logit dem_lead   partytreat pid7 if speeder~=1 & basictreat == 0
		eststo dem_own: logit dem_own   partytreat pid7 if speeder~=1  & basictreat == 0
		eststo rep_lead: logit rep_lead   partytreat pid7 if speeder~=1  & basictreat == 0
		eststo rep_own: logit rep_own   partytreat pid7 if speeder~=1  & basictreat == 0
		
	# delimit ;
	esttab using a2_lucid_control_party.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Difference between control and party treatment" )
		 label
		addnote("Dependent variable: views of party ownership")
		compress replace;
	 #delimit cr

	 

eststo clear 

mlogit dempolicy partytreat pid7  if speeder~=1  & basictreat == 0, nolog
eststo policy_rep: margins, dydx(partytreat) at(pid7=(1(1)7)) predict(equation(-1)) post
mlogit dempolicy partytreat pid7  if speeder~=1  & basictreat == 0, nolog
eststo policy_dem: margins, dydx(partytreat) at(pid7=(1(1)7)) predict(equation(1)) post
	 
	# delimit ;
	esttab using a2_lucid_partyeffects.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Survey experiment: effect of treatments mlogit" )
		 label
		addnote("Dependent variable: views of party ownership")
		compress replace;
	 #delimit cr


****************************************************
************ CCES quasi-experiment *****************
************ this data is from the CCES ************
************ subsample purchased by LSU ************
****************************************************
clear
use cces_metoo.dta 

svyset [pw=teamweight]


**** balance checks for quasi experiment **** 

eststo clear 

eststo balance: logit post_kav i.pid3clean fem 

 
	# delimit ;
	esttab using a2_cces_quasi_balance.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Balance checks for quasi experiment" )
		 label nonumber
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr
	
eststo clear 

***** the models below produce the results found in Figure 2 **** 

mlogit metoopartypolicy post_kav i.pid3clean fem, baseoutcome(0)
eststo dem_better_policy: margins, at(post_kav=(0,1)) atmeans predict(equation(-1))
eststo rep_better_policy: margins, at(post_kav=(0,1)) atmeans predict(equation(1))
mlogit metoopartymembers post_kav i.pid3clean fem , baseoutcome(0)
eststo dem_better_lead: margins, at(post_kav=(0,1)) atmeans predict(equation(-1))
eststo dem_better_lead: margins, at(post_kav=(0,1)) atmeans predict(equation(1))

	# delimit ;
	esttab using a2_cces_natural.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Balance checks for quasi experiment" )
		 label nonumber
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr
	
eststo clear 
*** appendix table associated with Figure 2 *** 

 	# delimit ;
	esttab using a2_cces_quasi_party_owner.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Pre-post Kavanaugh Hearings & views of party ownership" )
		 label
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr
	 
clear


 

clear

*****************************************************
*********** aggregate survey analysis ***************
*********** this data is from  surveys ************
*********** data obtained from Roper iPoll, *********
*********** ICPSR, PRRI, and PEW ********************
*********** see appendix for list of surveys ********
*********** and survey question wording *************
*****************************************************
clear 

use compiled_survey_data.dta 

**** generating single variables for big model **** 


eststo clear 

 mixed harassment_all i.democrat##i.year gender || survey:
 eststo diff: margins r.democrat@year, atmeans
 	marginsplot, title("") legend (rows(1) pos(6)) ///
	recast(line) recastci(rline) ciopts(lc(gray) lp(-) lw(vthin)) ///
	ylab(0 "0%" .25 "25%" .5 "50%", labsize(small)) ///
	xlab(, angle(45) labsize(small)) ///
	xtitle("") ///
	ytitle ("Diff between Democrats & Republicans", )  title("")
	graph save "3_party_time.gph", replace
	graph export "3_party_time.pdf", replace 
 
 
eststo clear 
  eststo party: mixed harassment_all i.democrat##i.year gender || survey:
  eststo gender:  mixed harassment_all i.gender##i.year democrat || survey:
		# delimit ;
		esttab party gender using a3_survey_agg_by_year.rtf, nogap se b(%9.3f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) 
			title("partisanship and gender in views sexual harassment" )
			 label nonumbers
			addnote("Dependent variable: sexual misconduct is a problem or positive views of victims")
			compress replace;
		#delimit cr

		
		
eststo clear 

 mixed harassment_all i.gender##i.year democrat || survey:
 eststo diff: margins r.gender@year, atmeans
 	marginsplot, title("") legend (rows(1) pos(6)) ///
	recast(line) recastci(rline) ciopts(lc(gray) lp(-) lw(vthin)) ///
	ylab(0 "0%" .25 "25%" .5 "50%", labsize(small)) ///
	xlab(, angle(45) labsize(small)) ///
	xtitle("") ///
	ytitle ("Diff between Men and Women", )  title("")
	graph save "a3_party_time_gender.gph", replace
	graph export "a3_party_time_gender.pdf", replace 
		
		**** by party within genders **** 
		
		
eststo clear 

 mixed harassment_all i.democrat##i.year if gender == 0 || survey:
 eststo diff: margins r.democrat@year, atmeans
 	marginsplot, title("") legend (rows(1) pos(6)) ///
	recast(line) recastci(rline) ciopts(lc(gray) lp(-) lw(vthin)) ///
	ylab(0 "0%" .25 "25%" .5 "50%", labsize(small)) ///
	xlab(, angle(45) labsize(small)) ///
	xtitle("Men") ///
	ytitle ("Democrats - Republican Men", size(small))  title("")
	graph save "a3_party_time_men.gph", replace
	graph export "a3_party_time_men.pdf", replace 
 
 eststo clear 

 mixed harassment_all i.democrat##i.year if gender == 1 || survey:
 eststo diff: margins r.democrat@year, atmeans
 	marginsplot, title("") legend (rows(1) pos(6)) ///
	recast(line) recastci(rline) ciopts(lc(gray) lp(-) lw(vthin)) ///
	ylab(0 "0%" .25 "25%" .5 "50%", labsize(small)) ///
	xlab(, angle(45) labsize(small)) ///
	xtitle("Women") ///
	ytitle ("Democrats - Republican Women", size(small))  title("")
	graph save "a3_party_time_women.gph", replace
	graph export "a3_party_time_women.pdf", replace 
	
	graph combine "a3_party_time_men.gph" "a3_party_time_women.gph", col(2)
	graph save "a3_party_time_pid_gender.gph", replace
	graph export "a3_party_time_pid_gender.pdf", replace 
	
 
	**** by party within genders ***** 
			
eststo clear 

 mixed harassment_all i.gender##i.year if democrat == 0 || survey:
 eststo diff: margins r.gender@year, atmeans
 	marginsplot, title("") legend (rows(1) pos(6)) ///
	recast(line) recastci(rline) ciopts(lc(gray) lp(-) lw(vthin)) ///
	ylab(0 "0%" .25 "25%" .5 "50%", labsize(small)) ///
	xlab(, angle(45) labsize(small)) ///
	xtitle("Republicans") ///
	ytitle ("Women - Men among Republicans", size(small))  title("")
	graph save "a3_party_time_reps.gph", replace
	graph export "a3_party_time_reps.pdf", replace 
 
 	
eststo clear 
 
 mixed harassment_all i.gender##i.year if democrat == 1 || survey:
 eststo diff: margins r.gender@year, atmeans
 	marginsplot, title("") legend (rows(1) pos(6)) ///
	recast(line) recastci(rline) ciopts(lc(gray) lp(-) lw(vthin)) ///
	ylab(0 "0%" .25 "25%" .5 "50%", labsize(small)) ///
	xlab(, angle(45) labsize(small)) ///
	xtitle("Democrats") ///
	ytitle ("Women - Men among among Democrats", size(small))  title("")
	graph save "a3_party_time_dem.gph", replace
	graph export "a3_party_time_dem.pdf", replace 
 
 
 
	graph combine "a3_party_time_reps.gph" "a3_party_time_dem.gph", col(2)
	graph save "a3_party_time_gender_pid.gph", replace
	graph export "a3_party_time_gender_pid.pdf", replace 
	
 
clear 

*************************************************
********** dataforprogress views of metoo *******
********** data from Data for Progress 2018 *****
********** survey fielded Oct 22, 2018 **********
*************************************************

**** you will need to download the data directly from Data for Progress
**** from https://wthh.dataforprogress.org/get-the-data 

gen democrats = 0
replace democrats = 1 if pid3 == 1
label variable democrats "Democratic PID" 


gen republicans = 0
replace republicans = 1 if pid3 == 2
label variable republicans "Republican PID" 

gen independent = 0
replace independent = 1 if pid3 == 3
label variable independent "Independent PID" 

recode gender 1=0 2=1
label define gender 0 "Male" 1 "Female" 
label variable gender "Gender" 

recode pid3 4=. 5=. 3=2 2=3
label variable pid3 "Party ID" 
label define pid3 1 "Democrat" 2 "Independent" 3 "Republican" 

gen strength_dem = .
replace strength_dem = 1 if pid7 == 2
replace strength_dem = 2 if pid7 == 1
replace strength_dem = 0 if pid7 == 3
label variable strength_dem "Strength of PID" 


gen strength_rep = .
replace strength_rep = 1 if pid7 == 6
replace strength_rep = 2 if pid7 == 7
replace strength_rep = 0 if pid7 == 5
label variable strength_rep "Strength of PID" 

gen married =0 
replace married =1 if marstat <=2
label variable married "Married" 

gen employed = 0
replace employed = 1 if employ <=2
label variable employed "Employed part or full time" 

recode faminc_new 97=.
label variable faminc_new "Income"

**** generating hostile sexism scale *** 

gen remarks = .
replace remarks = 1 if REMARKS == "4"
replace remarks = 2 if REMARKS == "3"
replace remarks = 3 if REMARKS == "2"
replace remarks = 4 if REMARKS == "1"
label variable remarks "women interpret innocent remarks as sexist"


gen offend = .
replace offend = 1 if OFFEND == "4"
replace offend = 2 if OFFEND == "3"
replace offend = 3 if OFFEND == "2"
replace offend = 4 if OFFEND == "1"
label variable remarks "women are too easily offended"


gen appreciate = .
replace appreciate = 1 if APPRECIATE == "4"
replace appreciate = 2 if APPRECIATE == "3"
replace appreciate = 3 if APPRECIATE == "2"
replace appreciate = 4 if APPRECIATE == "1"
label variable remarks "women fail to appreciate what men do for them"

egen hostile_sexism_scale = rowmean (remarks offend appreciate) 
label variable hostile_sexism_scale "Hostile sexism scale" 
egen z_hostile = sd(hostile_sexism_scale) 
label variable z_hostile "Hostile sexism scale" 

**** attitude controls **** 

recode direct 1=3 2=1 3=2
label  variable direct "Direction of country" 
label define direct 1 "Wrong track" 2 "Not sure" 3 "Right direction" 

rename app_dtrmp trump_approval
recode trump_approval 5=. 1=4 3=2 2=3 4=1
label variable trump_approval "Trump approval" 
label define trump_approval 1 "Strongly disapprove" 2 "Somewhat disapprove" 3 "Somewhat approve" 4 "Strong approve" 

gen generations = .
replace generations = 5 if GENERATIONS == "5"
replace generations =  4 if GENERATIONS == "4"
replace generations = 3 if GENERATIONS == "3"
replace generations = 2 if GENERATIONS == "2"
replace generations = 1 if GENERATIONS == "1"

gen favorsr =.
replace favorsr = 1 if FAVORS == "5"
replace favorsr = 2 if FAVORS == "4"
replace favorsr = 3 if FAVORS == "3"
replace favorsr = 4 if FAVORS == "2"
replace favorsr = 5 if FAVORS == "1"

gen institutions = .
replace institutions = 5 if INSTITUTION == "5"
replace institutions =  4 if INSTITUTION == "4"
replace institutions = 3 if INSTITUTION == "3"
replace institutions = 2 if INSTITUTION == "2"
replace institutions = 1 if INSTITUTION == "1"

gen favors =.
replace favors = 1 if FAVORS == "5"
replace favors = 2 if FAVORS == "4"
replace favors = 3 if FAVORS == "3"
replace favors = 4 if FAVORS == "2"
replace favors = 5 if FAVORS == "1"


gen empathy = .
replace empathy = 5 if EMPATHY == "5"
replace empathy = 4 if EMPATHY == "4"
replace empathy = 3 if EMPATHY == "3"
replace empathy = 2 if EMPATHY == "2"
replace empathy = 1 if EMPATHY == "1"

egen racism = rowmean (generations favorsr institutions favors empathy)



*** outcome variables of interest **** 

gen metoo_favorability = .
replace metoo_favorability = 1 if favor_metoo == 4
replace metoo_favorability = 2 if favor_metoo == 3
replace metoo_favorability = 3 if favor_metoo == 2
replace metoo_favorability = 4 if favor_metoo == 1
label variable metoo_favorability "Favorability of #MeToo"
label define metoo_favorability 1 "Strongly disapprove" 2 "Somewhat disapprove" 3 "Somewhat approve" 4 "Strongly approve" 

tab favor_metoo [aw=weight_DFP]

tab favor_metoo [aw=weight_DFP] if republicans==1
tab favor_metoo [aw=weight_DFP] if democrats==1
tab favor_metoo [aw=weight_DFP] if gender==1
tab favor_metoo [aw=weight_DFP] if gender==0

reg favor_metoo [aw=weight_DFP] if republicans==1
reg favor_metoo [aw=weight_DFP] if democrats==1
reg favor_metoo [aw=weight_DFP] if gender==1
reg favor_metoo [aw=weight_DFP] if gender==0

gen labor_favorability = .
replace labor_favorability = 1 if favor_labor == 4
replace labor_favorability = 2 if favor_labor == 3
replace labor_favorability = 3 if favor_labor == 2
replace labor_favorability = 4 if favor_labor == 1
label variable labor_favorability "Favorability of Labor Unions"
label define labor_favorability 1 "Strongly disapprove" 2 "Somewhat disapprove" 3 "Somewhat approve" 4 "Strongly approve" 


gen metoo_favorability_alt = .
replace metoo_favorability_alt = 1 if favor_metoo == 4
replace metoo_favorability_alt = 2 if favor_metoo == 3
replace metoo_favorability_alt = 3 if favor_metoo == 5 | favor_metoo == 6
replace metoo_favorability_alt = 4 if favor_metoo == 2
replace metoo_favorability_alt = 5 if favor_metoo == 1
label variable metoo_favorability_alt "Favorability of #MeToo DK"
label define metoo_favorability_alt 1 "Strongly disapprove" 2 "Somewhat disapprove" 3 "DK" 4 "Somewhat approve" 5 "Strongly approve" 


gen switch_party_d = .
replace switch_party_d = 0 if suprpty == 1
replace switch_party_d = 1 if suprpty == 2
label variable switch_party_d "Democrats who have not / have switched parties" 

gen switch_party_r = .
replace switch_party_r = 0 if suprpty == 4
replace switch_party_r = 1 if suprpty == 3
label variable switch_party_r "Republicans who have not / have switched parties" 


gen switch_party_d2 = 0
replace switch_party_d2 = 1 if suprpty == 2
label variable switch_party_d2 "Democrats who have switched parties" 

gen switch_party_r2 = 0
replace switch_party_r2 = 1 if suprpty == 3
label variable switch_party_r2 "Republicans who have switched parties" 

gen switch_party = .
replace switch_party = 0 if suprpty == 2
replace switch_party = 1 if suprpty == 3
label variable switch_party "Switched parties" 
label define switch_party 0 "Democrats to Republicans" 1 "Republicans to Democrats" 

gen dem_favor = . 
replace dem_favor = 1 if favor_dem == 4
replace dem_favor = 2 if favor_dem == 3
replace dem_favor = 3 if favor_dem == 2
replace dem_favor = 4 if favor_dem == 1
label variable dem_favor "Favorability of Democratic Party"
label define dem_favor 1 "Strongly disapprove" 2 "Somewhat disapprove" 3 "Somewhat approve" 4 "Strongly approve" 


gen rep_favor = . 
replace rep_favor = 1 if favor_rep == 4
replace rep_favor = 2 if favor_rep == 3
replace rep_favor = 3 if favor_rep == 2
replace rep_favor = 4 if favor_rep == 1
label variable rep_favor "Favorability of Republican Party"
label define rep_favor 1 "Strongly disapprove" 2 "Somewhat disapprove" 3 "Somewhat approve" 4 "Strongly approve" 


gen metoo_pos = 0
replace metoo_pos = . if metoo_favorability == 3
replace metoo_pos = . if metoo_favorability == 2
replace metoo_pos = 1 if metoo_favorability == 4
label variable metoo_pos "Unfavorable or favorable views of MeToo" 


label values metoo_favorability metoo_favorability
*splitvallabels metoo_favorability , length(11)


gen party_fav = dem_favor-rep_favor
label variable party_fav "Favorability of Dems - Reps"

label variable educ4 "Education"
label variable age5 "Age" 
label variable child18 "Child under 18" 
label variable racism "Racial resentment" 


	foreach var in party_fav {
		qui sum `var'
		replace `var' = (`var' - `r(min)') / (`r(max)'-`r(min)')
		}
		
**** save this transformed data because you will need to use it later! **** 
save dfp2018_clean.dta, replace 

clear 

use dfp2018_clean.dta

svyset [pw=weight_DFP]

*** setting up global controls **** 

global demographics race educ4 age5  child18 married employed faminc_new
global attitudes direct racism z_hostile

eststo clear 

**** how does PID  shape views of #MeToo? **** 

 eststo clear
 
reg metoo_favorability hostile_sexism_scale i.gender i.pid3 $demographics $attitudes [pw=weight_DFP]
eststo metoo_pid7:  margins, at(pid3=(1(1)3)) atmeans post
	coefplot metoo_pid7, ///
	xtitle ("Partisanship") ///
	ytitle ("#MeToo Favorability") ///
	ylab (1 "V. Unfavorable" 2 "Unfavorable" 3 "Favorable" 4 "V Favorable", labsize(small))  ///
	title ("") ///
	xlab(1 "Democrat" 2 "Independent" 3 "Republican", labsize(small)) ///
	vertical recast(bar) barwidth(0.3) fcolor(*.5) ///
	ciopts(recast(rcap)) citop citype(normal) format(%9.2f) 

	graph save Graph "a3_dfp_metoo_favor3.gph", replace
	graph export "a3_dfp_metoo_favor3.pdf", replace
	
	
		
clear 

*************************************************
********** affect towards parties 		*********
********** data from Data for Progress 2018 *****
********** survey fielded Oct 22, 2018 **********
*************************************************


use "dfp2018_clean.dta"

svyset [pw=weight_DFP]

*** setting up global controls **** 

global demographics race educ4 age5  child18 married employed faminc_new
global attitudes direct racism z_hostile


****  **** 

***** looking at Dem and Rep affect separately *** 


 
 	eststo clear
	
eststo dem_favor: reg dem_favor metoo_favorability i.gender i.pid3 $demographics $attitudes [pw=weight_DFP]
eststo dem_favor: margins, at(metoo_favorability=(1(1)4))    post
eststo rep_favor: reg rep_favor metoo_favorability i.gender i.pid3 $demographics $attitudes [pw=weight_DFP]
eststo rep_favor: margins, at(metoo_favorability=(1(1)4))    post
	coefplot (dem_favor, label (Dem Party Favorability)) (rep_favor, label (Rep Party Favorability)), ///
	ytitle ("Views of Parties") ylab (1 "V. Unfavorable" 2 "Unfavorable" 3 "Favorable" 4 "V. Favorable") ///
	xtitle ("#MeToo Favorability") ///
	vertical recast(bar) barwidth(.3) fcolor(*.5) ///
	title("") legend (rows(1) pos(6)) ///
	ciopts(recast(rcap)) citop format(%9.2f) ///
	xlab(1 "V. Unfavorable" 2 "Unfavorable" 3 "Favorable" 4 "V. Favorable",  labsize(small)) 
 	graph save Graph "4_dfp_eachparty.gph", replace
	graph export "4_dfp_eachparty.pdf", replace
	
	eststo clear
	
eststo dem_favor: reg dem_favor metoo_favorability i.gender i.pid3 $demographics $attitudes [pw=weight_DFP]
eststo rep_favor: reg rep_favor metoo_favorability i.gender i.pid3 $demographics $attitudes [pw=weight_DFP]
	

# delimit ;
esttab using a4_dfp_party_affect_sep.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Favorability of MeToo & Dem and Rep Party favorability" )
	 label nonumbers 
	addnote("Dependent variable: favorability of Dems and Reps")
	compress replace;
 #delimit cr
 
**** difference between the parties **** 

 eststo clear

reg party_fav metoo_favorability  i.gender pid7 $demographics $attitudes [pw=weight_DFP]
eststo dem_favor: margins, at(metoo_favorability=(1(1)4))   atmeans post  
	coefplot, ///
	ytitle ("View of Dem Party - View of Rep Party") ///
	xtitle ("#MeToo Favorability") ///
	title ("") ///
	vertical recast(bar) barwidth(.3) fcolor(*.5) ///
	ciopts(recast(rcap)) citop citype(logit) format(%9.2f) ///
	xlab(1 "V. Unfavorable" 2 "Unfavorable" 3 "Favorable" 4 "V. Favorable",  labsize(small)) 
 	graph save Graph "a4_dfp_party_affect.gph", replace
	graph export "a4_dfp_party_affect.pdf", replace
	
	 eststo clear
	 
	eststo party_fave: reg party_fav metoo_favorability  i.gender pid7 $demographics $attitudes  [pw=weight_DFP]
# delimit ;
esttab using a6_dfp_party_affect.rtf, nogap se b(%9.2f) starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.2f) 
	title("Favorability of MeToo & Parties" )
	 label nonumbers 
	addnote("Dependent variable: Views towards parties (Dem-Rep)")
	compress replace;
 #delimit cr	
 
 
 eststo clear

reg party_fav metoo_favorability  i.gender pid7 $demographics $attitudes [pw=weight_DFP]
eststo dem_favor: margins, at(metoo_favorability=(1(1)4))      post
reg party_fav labor_favorability  i.gender pid7 $demographics $attitudes [pw=weight_DFP]
eststo lab_favor: margins, at(labor_favorability=(1(1)4))      post
	coefplot (dem_favor, label (#MeToo Favorability)) (lab_favor, label (Labor Favorability)), ///
	ytitle ("View of Dem Party - View of Rep Party") ///
	xtitle ("#MeToo Favorability") ///
	title ("MeToo") ///
	vertical recast(bar) barwidth(.3) fcolor(*.5) ///
	ciopts(recast(rcap)) citop citype(logit) format(%9.2f) ///
	xlab(1 "V. Unfavorable" 2 "Unfavorable" 3 "Favorable" 4 "V. Favorable",  labsize(small)) 
 	graph save Graph "a4_dfp_party_affect.gph", replace
	graph export "a4_dfp_party_affect.pdf", replace
	

	
	**** C&S way of doing affect *** 
	
	
eststo clear 
reg party_fav metoo_pos i.gender pid7 $demographics $attitudes [pw=weight_DFP]
eststo dem_favor: margins, at(metoo_pos=(0,1))   atmeans post

	coefplot (dem_favor), ///
	xtitle ("MeToo views") ///
	ytitle ("Dem Party Favorability minus Republican Party Favorability") ///
	title("") vertical  ///
	xlab (1 "Unfavorable" 2 "Favorable")  

	graph save Graph "a4_dfp_party_affect_csway.gph", replace
	graph export "a4_dfp_party_affect_csway.pdf", replace
	

	

 

****************************************************
************ candidate vote choice *****************
************ data from KFF survey ******************
****************** July 2015  **********************
****************************************************

clear

	use kffdata.dta 	
	svyset [pw=weight]
	
	global demographics i.gender married employed edu white income

****************** Assessing relationship between party ID and vote based on metoo **************


eststo clear 
 
logit candidate_metoo2 i.pid3 $demographics [pw=weight]
eststo metoo_pid2:  margins, at(pid3=(1(1)3))     atmeans post
	coefplot, ///
	xtitle ("Partisanship") ///
	ytitle ("Vote for #MeToo Candidate") ///
	ylab(0 "0%" .2 "20%" .4 "40%" .6 "60%" .8 "80%" 1 "100%") ///
	title ("") ///
	vertical recast(bar) barwidth(0.3) fcolor(*.5) ///
	ciopts(recast(rcap)) citop citype(logit) format(%9.2f) ///
	xlab(1 "Democrat" 2 "Independent" 3 "Republican", labsize(small)) 
	
	graph save Graph "5_metoo_vote2.gph", replace
	graph export "5_metoo_vote2.pdf", replace

	eststo clear
	
	eststo metoovote: logit candidate_metoo2 i.pid3 $demographics [pw=weight]
		# delimit ;
	esttab using a7_kff_vote.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Candidate MeToo and vote" )
		 label nonumber 
		//addnote("Dependent variable: vote for candidate who takes MeToo stand")//
		compress replace;
	 #delimit cr

	
	
****************************************************
************ CCES vote switching *****************
************ this data is from the CCES ************
************ subsample purchased by LSU ************
****************************************************

clear
use cces_metoo.dta 

svyset [pw=teamweight]

global demographics  knowallcongress strength colgrad age fem partypolicymatch race2

**************** vote switching ***************** 

eststo basic_policy: svy: tab partyvote18loyal metoopolicyloyal, col
eststo basic_lead: svy: tab partyvote18loyal metoomemberloyal, col


 	# delimit ;
	esttab using 2table_cces_party_switch.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Vote switching & MeToo policy views" )
		 label nonumber 
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr
	 
tab partyvote18loyal
tab metoopolicyloyal
tab metoomemberloyal
	 
	 **** producing results for table **** 
eststo clear 

eststo o_policy: svy: oprobit partyvote18loyal metoopolicyloyal $demographics, nolog
eststo o_member: svy: oprobit  partyvote18loyal metoomemberloyal  $demographics,  nolog

 	# delimit ;
	esttab using 3table_cces_party_switch.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Vote switching & MeToo policy views" )
		 label nonumber 
		//addnote("Dependent variable")//
		compress replace;
	 #delimit cr

			
clear 

*************************************************
**************** party switching		*********
********** data from Data for Progress 2018 *****
********** survey fielded Oct 22, 2018 **********
*************************************************


use "dfp2018_clean.dta"


svyset [pw=weight_DFP]

*** setting up global controls **** 

global demographics race educ4 age5  child18 married employed faminc_new
global attitudes direct racism z_hostile
global attitudes2 direct racism z_hostile fear_of_demographic_change_scale


	 *** party switching *** 

eststo clear 

logit switch_party_d2 metoo_favorability  i.gender pid7 $demographics $attitudes [pw=weight_DFP]
eststo switch_dems2: margins, at(metoo_favorability=(1(1)4))     atmeans post
logit switch_party_r2 metoo_favorability  i.gender pid7 $demographics $attitudes  [pw=weight_DFP]
eststo switch_reps2: margins, at(metoo_favorability=(1(1)4))   atmeans post


	coefplot (switch_reps2, label(To Republican Party)) (switch_dems2, label (To Democratic Party)) , ///
	xtitle ("Views of #MeToo") ///
	ytitle ("Probability of switching") ///
	ylab (0 "0%" .05 "5%" .1 "10%" .15 "15%" .2 "20%") ///
	title("") legend (rows(1) pos(6)) ///
	vertical recast(bar) barwidth(0.3) fcolor(*.5) ///
	ciopts(recast(rcap)) citop citype(logit) format(%9.2f) ///
	xlab(1 "Very unfavorable" 2 "Somewhat unfavorable" 3 "Somewhat favorable" 4 "Favorable") 
	graph save Graph "6_dfp_switch_metoo.gph", replace
	graph export "6_dfp_switch_metoo.pdf", replace
	
	
	eststo clear 

logit switch_party_d2 metoo_favorability  i.gender pid7 $demographics $attitudes2  [pw=weight_DFP]
eststo switch_dems2: margins, at(metoo_favorability=(1(1)4))     atmeans post
logit switch_party_r2 metoo_favorability  i.gender pid7 $demographics $attitudes2  [pw=weight_DFP]
eststo switch_reps2: margins, at(metoo_favorability=(1(1)4))   atmeans post


	coefplot (switch_reps2, label(To Republican Party)) (switch_dems2, label (To Democratic Party)) , ///
	xtitle ("Views of #MeToo") ///
	ytitle ("Probability of switching") ///
	ylab (0 "0%" .05 "5%" .1 "10%" .15 "15%" .2 "20%") ///
	title("") legend (rows(1) pos(6)) ///
	vertical recast(bar) barwidth(0.3) fcolor(*.5) ///
	ciopts(recast(rcap)) citop citype(logit) format(%9.2f) ///
	xlab(1 "Very unfavorable" 2 "Somewhat unfavorable" 3 "Somewhat favorable" 4 "Favorable") 
	graph save Graph "a6_dfp_switch_metoo2.gph", replace
	graph export "a6_dfp_switch_metoo2.pdf", replace

	
eststo clear 
	
eststo switch_party_d2: logit switch_party_d2 metoo_favorability  i.gender pid7 $demographics $attitudes [pw=weight_DFP]
eststo switch_party_r2: logit switch_party_r2 metoo_favorability  i.gender pid7 $demographics $attitudes [pw=weight_DFP]
	
	 	# delimit ;
	esttab switch_party_d2 switch_party_r2 using a6_dfp_party_switch.rtf, nogap se starlevels(^ .10 * .05 ** .01 *** .001) r2(%9.3f) ///
		title("Party switching & MeToo policy views" )
		 label nonumber 
		addnote("Dependent variable: Probability of switching party") 
		compress replace;
	 #delimit cr

